/*
 * @Author: lr liruo_hrh@163.com
 * @Date: 2022-05-22 16:38:26
 * @LastEditors: lr liruo_hrh@163.com
 * @LastEditTime: 2022-05-23 11:02:58
 * @FilePath: \QQServerMySQL\src\server\service\SocketThreadManager.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package server.service;

import java.util.HashMap;
import java.util.Iterator;

public class SocketThreadManager {
    private static HashMap<String,UserThread> users=new HashMap<>();

    public static void addUserThread(String userId,UserThread userThread){
users.put(userId,userThread);
    }
    public static UserThread getUserThread(String userID){
        return users.get(userID);
    }
    public static boolean isExitUser(String userId){
        if(users.get(userId)==null)return false;
        return true;
    }
//    public static String getOnlineUser(String requestUser){
//        Iterator<String> iterator = users.keySet().iterator();
//        String userList="";
//        String temp="";
//        while(iterator.hasNext()){
//           if((temp=iterator.next())!=requestUser){
//               userList+=temp+" ";
//           }
//        }
//        return userList;
//    }
    // public static void removeUserThread(String userId){
    //     users.remove(userId);
    // }

    // public static HashMap<String, UserThread> getUsers() {
    //     return users;
    // }
}
